package com.example.demo.xml;

import java.io.*;
import java.util.Map;
import java.util.Set;

public class XmlTools {
    public static void main(String[] args) throws Exception {
        File file = new File("/Users/wangfei/Documents/book/tale.html");
        StringBuffer sb = new StringBuffer();
        try(BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));) {
            String content;
            while((content = br.readLine())!= null){
                sb.append(content);
            }

        } catch (IOException e) {
            e.printStackTrace();
        }
        String data = sb.toString();
        SuperXmlTools tool = new SuperXmlTools("UTF-8");
        SuperXMLNode root = tool.readerXML(data.getBytes("UTF-8"));

        Map<String, Object> map = root.getChildren();
        Set<Map.Entry<String, Object>> set = map.entrySet();
        for(Map.Entry entry : set) {
            SuperXMLNode node = (SuperXMLNode) entry.getValue();
            System.out.println(node.getChildren().toString());
        }
    }
}
